package com.jk.demos.Controller;

import com.jk.demos.Result.Result;
import com.jk.demos.entity.Article;
import com.jk.demos.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/article")
@Controller
public class ArticleController {
    @Autowired
    private ArticleService articleService;
    @GetMapping("/{id}")
    public Result<Article> GetById(@PathVariable Integer id){
        Article byId = articleService.getBYId(id);
        return Result.success(byId);
    }
}
